$(function(){
			$(".tipClass").tipTip({maxWidth: "auto", edgeOffset: 10});
});

$(document).ready(function() {
	
	$("#my_guests div").each(function(intIndex) {
		
		/* rotate guests foorsteps*/
		$(this).rotate(Math.random()*180);
		
		$("#my_guests img").each(function(intIndex) {
			$(this).css("width",Math.random()*30+20);
		});
		var l = Math.floor(Math.random() * ($(document).width()-50));
		var t = Math.floor(Math.random() * ($(document).height()-150)+50);
			
		
		$(this).css("left", l);
		$(this).css("top", t);

	}

	);
});

$(function() {
	$("#status_drag").draggable({
		cursor : "move",
		stop : function(event, ui) {
			$.post('user/writestatus', {
				x_coordinate : ui.position.top,
				y_coordinate : ui.position.left
			});
		}
	});
});

$(function() {
	$("#sex_drag").draggable({
		cursor : "move",
		stop : function(event, ui) {
			$.post('user/writesex', {
				x_coordinate : ui.position.top,
				y_coordinate : ui.position.left
			});
		}
	});
});

$(function() {
	$("#avatar_drag").draggable({
		cursor : "move",
		stop : function(event, ui) {
			$.post('user/writepoint', {
				x_coordinate : ui.position.top,
				y_coordinate : ui.position.left
			});
		}
	});
});


$(function() {
	$("#album_drag").draggable({
		cursor : "move",
		stop : function(event, ui) {
			$.post('user/writealbum', {
				x_coordinate : ui.position.top,
				y_coordinate : ui.position.left
			});
		}
	});
});

//loading more friends
$(document).ready(function(){
	
	function last_msg_funtion() 
	{ 
       var ID=$(".message_box:last").attr("id");
       var YEAR=$(".year_box").attr("id");
//		$('div#last_msg_loader').html('<img src="/img/progress.gif">');
		$.post("/friend/getmess?request="+YEAR+"&page="+ID,
		
		function(data){
			if (data != "") { 
			$(".message_box:last").after(data);			
			}
			$('div#last_msg_loader').empty();
		});
	};  
	
	$(window).scroll(function(){
		if  ($(window).scrollTop() == $(document).height() - $(window).height()){
		   last_msg_funtion();
		}
	}); 
	
});